package project.elements.base;

public class Task {
	private final Machine machine;
	private long cost;
	private long startTime;

	public Task(Machine machine, long cost) {
		this.machine = machine;
		this.cost = cost;
		this.startTime = -1;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Task == false) {
			return false;
		}
		return machine.equals(((Task) obj).machine);

	}

	public long getCost() {
		return cost;
	}

	public long getStartTime() {
		return startTime;
	}

	public Machine getMachine() {
		return machine;
	}

	public void setCost(long cost) {
		this.cost = cost;
	}

	public long getEndTime() {
		return startTime + cost;
	}

	public void start(long startTime) {
		if (this.startTime == -1) {
			this.startTime = startTime;
		}

	}
}
